<template>

    <!--BEGIN HEADER-->
    <div class="pure-menu pure-menu-open pure-menu-horizontal pure-menu-fixed head-menu">
        <a href="#" class="pure-menu-heading">
            <h3>物联网-金融管理项目</h3>
        </a>
        <ul>
            <li class="pure-menu-selected"><a href="#">主页</a></li>
            <li><a href="#" @click="TabkeInfo('PM')" v-show="data.UT_Name == '管理员'">项目管理</a></li>
            <li><a href="#" @click="TabkeInfo('IM')">投资管理</a></li>
            <li><a href="#">资产管理</a></li>
            <li><a href="#">标签页</a></li>
        </ul>
        <div class="head-menu-info">
            欢迎您，{{ data.UT_Name }} <a href="#">{{ data.UL_Name }}</a>。您选择【首页】【退出】
        </div>
    </div>
    <!--END HEADER-->
    <div class="pure-g content">
        <div class="pure-u-1">
            <div class="main">
                <div class="panel panel-default">
                    <div class="panel-body" v-show="ProjectManage">
                        <ShowInvestInfo></ShowInvestInfo>
                    </div>
                    <div class="panel-body" v-show="IManage&&data.UT_Name == '用户'">
                        <ShowUserInvestInfo></ShowUserInvestInfo>
                    </div>
                    <div class="panel-body" v-show="IManage&&data.UT_Name == '管理员'">
                        <ShowUserInvestDetail></ShowUserInvestDetail>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--BEGIN FOOT-->
    <div class="pure-g copyright">
        <div class="pure-u-1"> 2013 © TWStudio Admin Dashboard Template. </div>
    </div>

</template>

<script setup lang="ts">
import { useRoute } from 'vue-router'
import { ref, onMounted } from 'vue'
import axios from 'axios';
import ShowInvestInfo from './Invests/ShowInvestInfo.vue'
import ShowUserInvestInfo from './Invests/ShowUserInvestInfo.vue'
import ShowUserInvestDetail from './Invests/ShowUserInvestDetail.vue'


const route = useRoute()
//创建响应式数据
const data = ref({
    UT_Name: '',
    UL_Name: ''
})


console.log(route.query.Uid)

onMounted(() => {
    loadData();
})
//加载用户类型
const loadData = () => {
    axios.get('https://localhost:44387/api/Users/UserLoginInfo', {
        params: {
            Uid: route.query.Uid
        }
    }).then((res) => {
        console.log(res.data)
        data.value = res.data[0];
    })
}

//针对参数进行判断
const ProjectManage = ref(false)
const IManage = ref(false)
const TabkeInfo = (choose: string) => {
    switch (choose) {
        case 'PM':

            ProjectManage.value = true;
            IManage.value = false;
            break;
        case 'IM':

            IManage.value = true;
            ProjectManage.value = false;
            break;

        default:
            break;
    }
}

</script>